package br.com.lucasddaniel.merchanmobile.dao;

/**
 * Classe de cria�ao das tabelas.
 * 
 * @author ldsm
 * 
 */
public class PasseioEsquemaBanco {

    /** Define a vers�o do banco. */
    public static final int CURRENT_DATABASE_VERSION = 1;

    /** Nome da base da aplica��o. */
    public static final String DATA_BASE_NAME = "merchanmobile_db";

    /** Tabela de passeio. */
    public static final String TABLE_NAME = "tb_passeio";

    /** Chaves de tabelas como ex: chave estrangeira, etc... */
    public static final String TABLE_CONSTRAINTS = "";

    /** SQL de cria��o da tabela de passeio */
    public static final String SQL_CREATE_TABLE;

    /**
     * Cria��o da tabela de passeio.
     */
    public static final TableColumn TABLE_COLUMNS[] = {new TableColumn("id", "INTEGER PRIMARY KEY AUTOINCREMENT,"), new TableColumn("nome_turista", "TEXT,"), new TableColumn("nome_guia", "TEXT,"),
            new TableColumn("nome_pousada", "TEXT,"), new TableColumn("total_geral", "REAL,"), new TableColumn("desconto", "REAL,"), new TableColumn("sinal", "REAL,"),
            new TableColumn("saldo_Final", "REAL,"), new TableColumn("tipo_moeda", "TEXT,"), new TableColumn("data_hora_venda_passeio", "DATE")};

    /* Bloco de inicializa��o */
    static {
        final String CREATE_TABLE = "CREATE TABLE ";

        StringBuilder builder = new StringBuilder();

        SQL_CREATE_TABLE =
                builder.append(CREATE_TABLE).append(TABLE_NAME).append("(").append(TABLE_COLUMNS[0]).append(TABLE_COLUMNS[1]).append(TABLE_COLUMNS[2]).append(TABLE_COLUMNS[3])
                        .append(TABLE_COLUMNS[4]).append(TABLE_COLUMNS[5]).append(TABLE_COLUMNS[6]).append(TABLE_COLUMNS[7]).append(TABLE_COLUMNS[8]).append(TABLE_COLUMNS[9])
                        .append(TABLE_CONSTRAINTS).append(")").toString();
        builder.setLength(0);
    }

    public static class TableColumn {
        String columnName;
        String columnType;

        public TableColumn(String name, String type) {
            this.columnName = name;
            this.columnType = type;
        }

        public String getColumnName() {
            return this.columnName;
        }

        public String toString() {
            return columnName + " " + columnType;
        }
    }
}
